/*
 * @Author: your name
 * @Date: 2022-01-31 19:02:31
 * @LastEditTime: 2022-03-06 21:15:16
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \vue3-ts-food-admin\src\api\cloud.ts
 */
import {
  IResponse,
  UserInfo,
  CompanyDetail,
  SeatCategory,
  SeatDetailItem,
  DeliverInfo,
  OrderGoods,
  ProfitDistribution,
  PaymentInfo,
  SalesCategory,
} from "@/types/index";

import request from "@/utils/request";
import { Axios, AxiosResponse } from "axios";

export function login(data: {
  username: string;
  password: string;
}): Promise<AxiosResponse<IResponse<string>>> {
  return request({
    url: "/login",
    method: "post",
    data,
  });
}

export function getUserInfo(): Promise<AxiosResponse<IResponse<UserInfo>>> {
  return request({
    url: "/getUserInfo",
    method: "get",
  });
}

export function getCompanyDetail(): Promise<
  AxiosResponse<IResponse<CompanyDetail>>
> {
  return request({
    url: "/getCompanyDetailById",
    method: "get",
  });
}

export function getSeatCategory(): Promise<
  AxiosResponse<IResponse<SeatCategory[]>>
> {
  return request({
    url: "/getSeatCatrgory",
    method: "get",
  });
}

export function getSeatCategoryDetails(
  id: number,
  name: string
): Promise<AxiosResponse<IResponse<SeatDetailItem[]>>> {
  return request({
    url: "/getSeatListByCatrgoryId",
    method: "get",
    params: { id, name },
  });
}

export function getDeliverList(): Promise<
  AxiosResponse<IResponse<DeliverInfo[]>>
> {
  return request({
    url: "/getDeliverList",
    method: "get",
  });
}

export function getOrderGoodsDemo(): Promise<
  AxiosResponse<IResponse<OrderGoods[]>>
> {
  return request({
    url: "/getOrderGoodsDemo",
    method: "get",
  });
}

export function getProfitDistribution(): Promise<
  AxiosResponse<IResponse<ProfitDistribution>>
> {
  return request({
    url: "/getProfitDistribution",
    method: "get",
  });
}

export function getPaymentInfo(): Promise<
  AxiosResponse<IResponse<PaymentInfo>>
> {
  return request({
    url: "/getPaymentInfo",
    method: "get",
  });
}

export function getSalesCategory(): Promise<
  AxiosResponse<IResponse<SalesCategory[]>>
> {
  return request({
    url: "/getSalesCategory",
    method: "get",
  });
}
